common.validator = {
	regex : {
		_require : /.+/,
		_email : /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
		_phone : /^((\(\d{3}\))|(\d{3}\-))?((0\d{2,3})|(0\d{2,3}-))?[1-9]\d{6,7}$/,
		_mobile : /^((\(\d{3}\))|(\d{3}\-))?(13|15)\d{9}$/,
		_url : /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,
		_idCard : /^\d{15}(\d{2}[A-Za-z0-9])?$/,
		_currency : /^\d+(\.\d+)?$/,
		_number : /^\d+$/,
		_zip : /^[1-9]\d{5}$/,
		_qq : /^[1-9]\d{4,8}$/,
		_integer : /^[-\+]?\d+$/,
		_double : /^[-\+]?\d+(\.\d+)?$/,
		_english : /^[A-Za-z]+$/,
		_chinese :  /^[\u0391-\uFFE5]+$/,
		_unSafe : /^(([A-Z]*|[a-z]*|\d*|[-_\~!@#\$%\^&\*\.\(\)\[\]\{\}<>\?\\\/\'\"]*)|.{0,5})$|\s/,
		_date: /^(\d{4})([-.\/])(\d{2})\2(\d{2})$/
	},
	// 长度，中文算1个字节
	length : function(str) {
		return str.length;
	},
	// 长度，中文算2个字节
	lengthW : function(str) {
		return str.replace(/[\u0391-\uFFE5]/g, "**").length;;
	},
	// 是否匹配正则表达式
	match : function(str, regex) {
		return new RegExp(regex).test(str);
	},
	// 2个字符串是否相同
	compare : function(str1, str2, operateor) {
		switch (operateor) {
			case '=' : return str1 == str2;
			case '>' : return str1 > str2;
			case '>=' : return str1 >= str2;
			case '<' : return str1 < str2;
			case '<=' : return str1 <= str2;
		}
	}
};